import request from '@/assets/utils/request'
import type {Address} from '@/types/cart'

// 获取所有收货地址
export const getAddress = (): Promise<any> => request.get('member/address')

// 新增收货地址
export const addAddress = (addr: Address): Promise<any> => request.post('member/address', addr)

// 更新收货地址
export const updateAddress = (addr: Address): Promise<any> => request.put(`member/address/${addr.id ?? ''}`, addr)

// 删除收货地址
export const delAddress = (addr: Address): Promise<any> => request.delete(`member/address/${addr.id ?? ''}`, addr)